package com.java.learning.cha1;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;

public class PrintStreamDemo {
    public static void main(String[] args) {
        try (PrintStream ps = new PrintStream(new FileOutputStream("D:\\test.txt"))) {
            ps.println("这是PrintStream打印流往文件中写数据！");
            System.out.println("已保存");
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}
